package com.itheima.myexception;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Component
@ControllerAdvice
public class MyException {

    @ExceptionHandler(BusinessException.class)
    public String doException(BusinessException e){
        return e.getMessage();
    }

}
